<?php namespace Admin\Api;


class Log{
	
	protected $error = '未知错误';
	
	protected $db;
	
	public function __construct()
	{
		$this->db = new \Admin\Model\Log;
	}
	
	public function save($username,$message)
	{
		$data['username'] = $username;
		$data['content'] = $message;
		
		if($this->db->create($data))
		{
			return $this->db->add();
		}
	}
	
	
	public function getError()
	{
		return $this->db->getError()?:$this->error;
	}
	
}


















